/*
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';

import '../controllers/notification_controller.dart';


class NotificationHelper{
  static late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;
  static late String mToken;
  static int count =0;

  static Future<void> init()async{
    flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
    var androidInitialize = const AndroidInitializationSettings(
        '@mipmap/ic_launcher');
    var initializationSettings = InitializationSettings(
        android: androidInitialize);
    flutterLocalNotificationsPlugin.initialize(
      initializationSettings,
      onDidReceiveNotificationResponse: (payload) {

        try {
        } catch (e) {
          if (kDebugMode) {
            print("error on onDidReceiveNotificationResponse");
          }
        }
      },
    );
    FirebaseMessaging.onMessage.listen((RemoteMessage message) async {
      NotificationHelper.getCountUnseen();
      BigTextStyleInformation bigTextStyleInformation = BigTextStyleInformation(
        message.notification!.body.toString(),
        htmlFormatBigText: true,
        contentTitle: message.notification!.title.toString(),
        htmlFormatContentTitle: true,
      );
      AndroidNotificationDetails androidNotificationDetails = AndroidNotificationDetails(
        'dbfood',
        'dbfood',
        importance: Importance.high,
        styleInformation: bigTextStyleInformation,
        priority: Priority.high,
        playSound: true,
      );
      NotificationDetails notificationDetails = NotificationDetails(
        android: androidNotificationDetails,
      );
      await NotificationHelper.flutterLocalNotificationsPlugin.show(
        0,
        message.notification?.title,
        message.notification?.body,
        notificationDetails,
        payload: message.data['body'],
      );

    });
    await cacheToken();
  }
  static Future<String> cacheToken()async{
    await FirebaseMessaging.instance.getToken().then((token){
      if(token == null) {
        return;
      }
      mToken = token;
      if(kDebugMode){
        print("token is $token");
      }
    });
    return mToken;

  }
  static Future<void> requestPermission() async{
    FirebaseMessaging messaging = FirebaseMessaging.instance;
    NotificationSettings settings = await messaging.requestPermission(
      alert: true,
      announcement: false,
      badge: true,
      carPlay: false,
      criticalAlert: false,
      provisional: false,
      sound: true,
    );
    if(settings.authorizationStatus ==AuthorizationStatus.authorized){
      print('user geranted permission');
    }
    else if (settings.authorizationStatus ==AuthorizationStatus.provisional){
      print('user geranted provisional permission');
    }
    else {
      print('user decline or has ot accept');
    }
  }

  static getCountUnseen(){
    NotificationController.count().then((value) {
      value.fold((l) {
      },(r){
        count = r;
      });
    });
  }

}*/
